//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_spi(SotoInternal) import SotoCore

extension Account {
    // MARK: Enums

    public enum AlternateContactType: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case billing = "BILLING"
        case operations = "OPERATIONS"
        case security = "SECURITY"
        public var description: String { return self.rawValue }
    }

    public enum PrimaryEmailUpdateStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case accepted = "ACCEPTED"
        case pending = "PENDING"
        public var description: String { return self.rawValue }
    }

    public enum RegionOptStatus: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case disabled = "DISABLED"
        case disabling = "DISABLING"
        case enabled = "ENABLED"
        case enabledByDefault = "ENABLED_BY_DEFAULT"
        case enabling = "ENABLING"
        public var description: String { return self.rawValue }
    }

    public enum ValidationExceptionReason: String, CustomStringConvertible, Codable, Sendable, CodingKeyRepresentable {
        case fieldValidationFailed = "fieldValidationFailed"
        case invalidRegionOptTarget = "invalidRegionOptTarget"
        public var description: String { return self.rawValue }
    }

    // MARK: Shapes

    public struct AcceptPrimaryEmailUpdateRequest: AWSEncodableShape {
        /// Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. This operation can only be called from the management account or the delegated administrator account of an organization for a member account.  The management account can't specify its own AccountId.
        public let accountId: String
        /// The OTP code sent to the PrimaryEmail specified on the StartPrimaryEmailUpdate API call.
        public let otp: String
        /// The new primary email address for use with the specified account. This must match the PrimaryEmail from the StartPrimaryEmailUpdate API call.
        public let primaryEmail: String

        @inlinable
        public init(accountId: String, otp: String, primaryEmail: String) {
            self.accountId = accountId
            self.otp = otp
            self.primaryEmail = primaryEmail
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
            try self.validate(self.otp, name: "otp", parent: name, pattern: "^[a-zA-Z0-9]{6}$")
            try self.validate(self.primaryEmail, name: "primaryEmail", parent: name, max: 64)
            try self.validate(self.primaryEmail, name: "primaryEmail", parent: name, min: 5)
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
            case otp = "Otp"
            case primaryEmail = "PrimaryEmail"
        }
    }

    public struct AcceptPrimaryEmailUpdateResponse: AWSDecodableShape {
        /// Retrieves the status of the accepted primary email update request.
        public let status: PrimaryEmailUpdateStatus?

        @inlinable
        public init(status: PrimaryEmailUpdateStatus? = nil) {
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case status = "Status"
        }
    }

    public struct AccessDeniedException: AWSErrorShape {
        /// The value populated to the x-amzn-ErrorType response header by API Gateway.
        public let errorType: String?
        public let message: String

        @inlinable
        public init(errorType: String? = nil, message: String) {
            self.errorType = errorType
            self.message = message
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.errorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
            self.message = try container.decode(String.self, forKey: .message)
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct AlternateContact: AWSDecodableShape {
        /// The type of alternate contact.
        public let alternateContactType: AlternateContactType?
        /// The email address associated with this alternate contact.
        public let emailAddress: String?
        /// The name associated with this alternate contact.
        public let name: String?
        /// The phone number associated with this alternate contact.
        public let phoneNumber: String?
        /// The title associated with this alternate contact.
        public let title: String?

        @inlinable
        public init(alternateContactType: AlternateContactType? = nil, emailAddress: String? = nil, name: String? = nil, phoneNumber: String? = nil, title: String? = nil) {
            self.alternateContactType = alternateContactType
            self.emailAddress = emailAddress
            self.name = name
            self.phoneNumber = phoneNumber
            self.title = title
        }

        private enum CodingKeys: String, CodingKey {
            case alternateContactType = "AlternateContactType"
            case emailAddress = "EmailAddress"
            case name = "Name"
            case phoneNumber = "PhoneNumber"
            case title = "Title"
        }
    }

    public struct ConflictException: AWSErrorShape {
        /// The value populated to the x-amzn-ErrorType response header by API Gateway.
        public let errorType: String?
        public let message: String

        @inlinable
        public init(errorType: String? = nil, message: String) {
            self.errorType = errorType
            self.message = message
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.errorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
            self.message = try container.decode(String.self, forKey: .message)
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct ContactInformation: AWSEncodableShape & AWSDecodableShape {
        /// The first line of the primary contact address.
        public let addressLine1: String
        /// The second line of the primary contact address, if any.
        public let addressLine2: String?
        /// The third line of the primary contact address, if any.
        public let addressLine3: String?
        /// The city of the primary contact address.
        public let city: String
        /// The name of the company associated with the primary contact information, if any.
        public let companyName: String?
        /// The ISO-3166 two-letter country code for the primary contact address.
        public let countryCode: String
        /// The district or county of the primary contact address, if any.
        public let districtOrCounty: String?
        /// The full name of the primary contact address.
        public let fullName: String
        /// The phone number of the primary contact information. The number will be validated and, in some countries, checked for activation.
        public let phoneNumber: String
        /// The postal code of the primary contact address.
        public let postalCode: String
        /// The state or region of the primary contact address. If the mailing address is within the United States (US), the value in this field can be either a two character state code (for example, NJ) or the full state name (for example, New Jersey). This field is required in the following countries: US, CA, GB, DE, JP, IN, and BR.
        public let stateOrRegion: String?
        /// The URL of the website associated with the primary contact information, if any.
        public let websiteUrl: String?

        @inlinable
        public init(addressLine1: String, addressLine2: String? = nil, addressLine3: String? = nil, city: String, companyName: String? = nil, countryCode: String, districtOrCounty: String? = nil, fullName: String, phoneNumber: String, postalCode: String, stateOrRegion: String? = nil, websiteUrl: String? = nil) {
            self.addressLine1 = addressLine1
            self.addressLine2 = addressLine2
            self.addressLine3 = addressLine3
            self.city = city
            self.companyName = companyName
            self.countryCode = countryCode
            self.districtOrCounty = districtOrCounty
            self.fullName = fullName
            self.phoneNumber = phoneNumber
            self.postalCode = postalCode
            self.stateOrRegion = stateOrRegion
            self.websiteUrl = websiteUrl
        }

        public func validate(name: String) throws {
            try self.validate(self.addressLine1, name: "addressLine1", parent: name, max: 60)
            try self.validate(self.addressLine1, name: "addressLine1", parent: name, min: 1)
            try self.validate(self.addressLine2, name: "addressLine2", parent: name, max: 60)
            try self.validate(self.addressLine2, name: "addressLine2", parent: name, min: 1)
            try self.validate(self.addressLine3, name: "addressLine3", parent: name, max: 60)
            try self.validate(self.addressLine3, name: "addressLine3", parent: name, min: 1)
            try self.validate(self.city, name: "city", parent: name, max: 50)
            try self.validate(self.city, name: "city", parent: name, min: 1)
            try self.validate(self.companyName, name: "companyName", parent: name, max: 50)
            try self.validate(self.companyName, name: "companyName", parent: name, min: 1)
            try self.validate(self.countryCode, name: "countryCode", parent: name, max: 2)
            try self.validate(self.countryCode, name: "countryCode", parent: name, min: 2)
            try self.validate(self.districtOrCounty, name: "districtOrCounty", parent: name, max: 50)
            try self.validate(self.districtOrCounty, name: "districtOrCounty", parent: name, min: 1)
            try self.validate(self.fullName, name: "fullName", parent: name, max: 50)
            try self.validate(self.fullName, name: "fullName", parent: name, min: 1)
            try self.validate(self.phoneNumber, name: "phoneNumber", parent: name, max: 20)
            try self.validate(self.phoneNumber, name: "phoneNumber", parent: name, min: 1)
            try self.validate(self.phoneNumber, name: "phoneNumber", parent: name, pattern: "^[+][\\s0-9()-]+$")
            try self.validate(self.postalCode, name: "postalCode", parent: name, max: 20)
            try self.validate(self.postalCode, name: "postalCode", parent: name, min: 1)
            try self.validate(self.stateOrRegion, name: "stateOrRegion", parent: name, max: 50)
            try self.validate(self.stateOrRegion, name: "stateOrRegion", parent: name, min: 1)
            try self.validate(self.websiteUrl, name: "websiteUrl", parent: name, max: 256)
            try self.validate(self.websiteUrl, name: "websiteUrl", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case addressLine1 = "AddressLine1"
            case addressLine2 = "AddressLine2"
            case addressLine3 = "AddressLine3"
            case city = "City"
            case companyName = "CompanyName"
            case countryCode = "CountryCode"
            case districtOrCounty = "DistrictOrCounty"
            case fullName = "FullName"
            case phoneNumber = "PhoneNumber"
            case postalCode = "PostalCode"
            case stateOrRegion = "StateOrRegion"
            case websiteUrl = "WebsiteUrl"
        }
    }

    public struct DeleteAlternateContactRequest: AWSEncodableShape {
        /// Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId; it must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
        public let accountId: String?
        /// Specifies which of the alternate contacts to delete.
        public let alternateContactType: AlternateContactType

        @inlinable
        public init(accountId: String? = nil, alternateContactType: AlternateContactType) {
            self.accountId = accountId
            self.alternateContactType = alternateContactType
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
            case alternateContactType = "AlternateContactType"
        }
    }

    public struct DisableRegionRequest: AWSEncodableShape {
        /// Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
        public let accountId: String?
        /// Specifies the Region-code for a given Region name (for example, af-south-1). When you disable a Region, Amazon Web Services performs actions to deactivate that Region in your account, such as destroying IAM resources in the Region. This process takes a few minutes for most accounts, but this can take several hours. You cannot enable the Region until the disabling process is fully completed.
        public let regionName: String

        @inlinable
        public init(accountId: String? = nil, regionName: String) {
            self.accountId = accountId
            self.regionName = regionName
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
            try self.validate(self.regionName, name: "regionName", parent: name, max: 50)
            try self.validate(self.regionName, name: "regionName", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
            case regionName = "RegionName"
        }
    }

    public struct EnableRegionRequest: AWSEncodableShape {
        /// Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
        public let accountId: String?
        /// Specifies the Region-code for a given Region name (for example, af-south-1). When you enable a Region, Amazon Web Services performs actions to prepare your account in that Region, such as distributing your IAM resources to the Region. This process takes a few minutes for most accounts, but it can take several hours. You cannot use the Region until this process is complete. Furthermore, you cannot disable the Region until the enabling process is fully completed.
        public let regionName: String

        @inlinable
        public init(accountId: String? = nil, regionName: String) {
            self.accountId = accountId
            self.regionName = regionName
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
            try self.validate(self.regionName, name: "regionName", parent: name, max: 50)
            try self.validate(self.regionName, name: "regionName", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
            case regionName = "RegionName"
        }
    }

    public struct GetAccountInformationRequest: AWSEncodableShape {
        /// Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId; it must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
        public let accountId: String?

        @inlinable
        public init(accountId: String? = nil) {
            self.accountId = accountId
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
        }
    }

    public struct GetAccountInformationResponse: AWSDecodableShape {
        /// The date and time the account was created.
        @OptionalCustomCoding<ISO8601DateCoder>
        public var accountCreatedDate: Date?
        /// Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. This operation can only be called from the management account or the delegated administrator account of an organization for a member account.  The management account can't specify its own AccountId.
        public let accountId: String?
        /// The name of the account.
        public let accountName: String?

        @inlinable
        public init(accountCreatedDate: Date? = nil, accountId: String? = nil, accountName: String? = nil) {
            self.accountCreatedDate = accountCreatedDate
            self.accountId = accountId
            self.accountName = accountName
        }

        private enum CodingKeys: String, CodingKey {
            case accountCreatedDate = "AccountCreatedDate"
            case accountId = "AccountId"
            case accountName = "AccountName"
        }
    }

    public struct GetAlternateContactRequest: AWSEncodableShape {
        /// Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId; it must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
        public let accountId: String?
        /// Specifies which alternate contact you want to retrieve.
        public let alternateContactType: AlternateContactType

        @inlinable
        public init(accountId: String? = nil, alternateContactType: AlternateContactType) {
            self.accountId = accountId
            self.alternateContactType = alternateContactType
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
            case alternateContactType = "AlternateContactType"
        }
    }

    public struct GetAlternateContactResponse: AWSDecodableShape {
        /// A structure that contains the details for the specified alternate contact.
        public let alternateContact: AlternateContact?

        @inlinable
        public init(alternateContact: AlternateContact? = nil) {
            self.alternateContact = alternateContact
        }

        private enum CodingKeys: String, CodingKey {
            case alternateContact = "AlternateContact"
        }
    }

    public struct GetContactInformationRequest: AWSEncodableShape {
        /// Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
        public let accountId: String?

        @inlinable
        public init(accountId: String? = nil) {
            self.accountId = accountId
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
        }
    }

    public struct GetContactInformationResponse: AWSDecodableShape {
        /// Contains the details of the primary contact information associated with an Amazon Web Services account.
        public let contactInformation: ContactInformation?

        @inlinable
        public init(contactInformation: ContactInformation? = nil) {
            self.contactInformation = contactInformation
        }

        private enum CodingKeys: String, CodingKey {
            case contactInformation = "ContactInformation"
        }
    }

    public struct GetPrimaryEmailRequest: AWSEncodableShape {
        /// Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. This operation can only be called from the management account or the delegated administrator account of an organization for a member account.  The management account can't specify its own AccountId.
        public let accountId: String

        @inlinable
        public init(accountId: String) {
            self.accountId = accountId
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
        }
    }

    public struct GetPrimaryEmailResponse: AWSDecodableShape {
        /// Retrieves the primary email address associated with the specified account.
        public let primaryEmail: String?

        @inlinable
        public init(primaryEmail: String? = nil) {
            self.primaryEmail = primaryEmail
        }

        private enum CodingKeys: String, CodingKey {
            case primaryEmail = "PrimaryEmail"
        }
    }

    public struct GetRegionOptStatusRequest: AWSEncodableShape {
        /// Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
        public let accountId: String?
        /// Specifies the Region-code for a given Region name (for example, af-south-1). This function will return the status of whatever Region you pass into this parameter.
        public let regionName: String

        @inlinable
        public init(accountId: String? = nil, regionName: String) {
            self.accountId = accountId
            self.regionName = regionName
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
            try self.validate(self.regionName, name: "regionName", parent: name, max: 50)
            try self.validate(self.regionName, name: "regionName", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
            case regionName = "RegionName"
        }
    }

    public struct GetRegionOptStatusResponse: AWSDecodableShape {
        /// The Region code that was passed in.
        public let regionName: String?
        /// One of the potential statuses a Region can undergo (Enabled, Enabling, Disabled, Disabling, Enabled_By_Default).
        public let regionOptStatus: RegionOptStatus?

        @inlinable
        public init(regionName: String? = nil, regionOptStatus: RegionOptStatus? = nil) {
            self.regionName = regionName
            self.regionOptStatus = regionOptStatus
        }

        private enum CodingKeys: String, CodingKey {
            case regionName = "RegionName"
            case regionOptStatus = "RegionOptStatus"
        }
    }

    public struct InternalServerException: AWSErrorShape {
        /// The value populated to the x-amzn-ErrorType response header by API Gateway.
        public let errorType: String?
        public let message: String

        @inlinable
        public init(errorType: String? = nil, message: String) {
            self.errorType = errorType
            self.message = message
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.errorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
            self.message = try container.decode(String.self, forKey: .message)
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct ListRegionsRequest: AWSEncodableShape {
        /// Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
        public let accountId: String?
        /// The total number of items to return in the command’s output. If the total number of items available is more than the value specified, a NextToken is provided in the command’s output. To resume pagination, provide the NextToken value in the starting-token argument of a subsequent command. Do not use the NextToken response element directly outside of the Amazon Web Services CLI. For usage examples, see Pagination in the Amazon Web Services Command Line Interface User Guide.
        public let maxResults: Int?
        /// A token used to specify where to start paginating. This is the NextToken from a previously truncated response. For usage examples, see Pagination in the Amazon Web Services Command Line Interface User Guide.
        public let nextToken: String?
        /// A list of Region statuses (Enabling, Enabled, Disabling, Disabled, Enabled_by_default) to use to filter the list of Regions for a given account. For example, passing in a value of ENABLING will only return a list of Regions with a Region status of ENABLING.
        public let regionOptStatusContains: [RegionOptStatus]?

        @inlinable
        public init(accountId: String? = nil, maxResults: Int? = nil, nextToken: String? = nil, regionOptStatusContains: [RegionOptStatus]? = nil) {
            self.accountId = accountId
            self.maxResults = maxResults
            self.nextToken = nextToken
            self.regionOptStatusContains = regionOptStatusContains
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
            case maxResults = "MaxResults"
            case nextToken = "NextToken"
            case regionOptStatusContains = "RegionOptStatusContains"
        }
    }

    public struct ListRegionsResponse: AWSDecodableShape {
        /// If there is more data to be returned, this will be populated. It should be passed into the next-token request parameter of list-regions.
        public let nextToken: String?
        /// This is a list of Regions for a given account, or if the filtered parameter was used, a list of Regions that match the filter criteria set in the filter parameter.
        public let regions: [Region]?

        @inlinable
        public init(nextToken: String? = nil, regions: [Region]? = nil) {
            self.nextToken = nextToken
            self.regions = regions
        }

        private enum CodingKeys: String, CodingKey {
            case nextToken = "NextToken"
            case regions = "Regions"
        }
    }

    public struct PutAccountNameRequest: AWSEncodableShape {
        /// Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId; it must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
        public let accountId: String?
        /// The name of the account.
        public let accountName: String

        @inlinable
        public init(accountId: String? = nil, accountName: String) {
            self.accountId = accountId
            self.accountName = accountName
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
            try self.validate(self.accountName, name: "accountName", parent: name, max: 50)
            try self.validate(self.accountName, name: "accountName", parent: name, min: 1)
            try self.validate(self.accountName, name: "accountName", parent: name, pattern: "^[ -;=?-~]+$")
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
            case accountName = "AccountName"
        }
    }

    public struct PutAlternateContactRequest: AWSEncodableShape {
        /// Specifies the 12 digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you do not specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account, and the specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId; it must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, then don't specify this parameter, and call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
        public let accountId: String?
        /// Specifies which alternate contact you want to create or update.
        public let alternateContactType: AlternateContactType
        /// Specifies an email address for the alternate contact.
        public let emailAddress: String
        /// Specifies a name for the alternate contact.
        public let name: String
        /// Specifies a phone number for the alternate contact.
        public let phoneNumber: String
        /// Specifies a title for the alternate contact.
        public let title: String

        @inlinable
        public init(accountId: String? = nil, alternateContactType: AlternateContactType, emailAddress: String, name: String, phoneNumber: String, title: String) {
            self.accountId = accountId
            self.alternateContactType = alternateContactType
            self.emailAddress = emailAddress
            self.name = name
            self.phoneNumber = phoneNumber
            self.title = title
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
            try self.validate(self.emailAddress, name: "emailAddress", parent: name, max: 254)
            try self.validate(self.emailAddress, name: "emailAddress", parent: name, min: 1)
            try self.validate(self.emailAddress, name: "emailAddress", parent: name, pattern: "^[\\s]*[\\w+=.#|!&-]+@[\\w.-]+\\.[\\w]+[\\s]*$")
            try self.validate(self.name, name: "name", parent: name, max: 64)
            try self.validate(self.name, name: "name", parent: name, min: 1)
            try self.validate(self.phoneNumber, name: "phoneNumber", parent: name, max: 25)
            try self.validate(self.phoneNumber, name: "phoneNumber", parent: name, min: 1)
            try self.validate(self.phoneNumber, name: "phoneNumber", parent: name, pattern: "^[\\s0-9()+-]+$")
            try self.validate(self.title, name: "title", parent: name, max: 50)
            try self.validate(self.title, name: "title", parent: name, min: 1)
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
            case alternateContactType = "AlternateContactType"
            case emailAddress = "EmailAddress"
            case name = "Name"
            case phoneNumber = "PhoneNumber"
            case title = "Title"
        }
    }

    public struct PutContactInformationRequest: AWSEncodableShape {
        /// Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. If you don't specify this parameter, it defaults to the Amazon Web Services account of the identity used to call the operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned.  The management account can't specify its own AccountId. It must call the operation in standalone context by not including the AccountId parameter.  To call this operation on an account that is not a member of an organization, don't specify this parameter. Instead, call the operation using an identity belonging to the account whose contacts you wish to retrieve or modify.
        public let accountId: String?
        /// Contains the details of the primary contact information associated with an Amazon Web Services account.
        public let contactInformation: ContactInformation

        @inlinable
        public init(accountId: String? = nil, contactInformation: ContactInformation) {
            self.accountId = accountId
            self.contactInformation = contactInformation
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
            try self.contactInformation.validate(name: "\(name).contactInformation")
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
            case contactInformation = "ContactInformation"
        }
    }

    public struct Region: AWSDecodableShape {
        /// The Region code of a given Region (for example, us-east-1).
        public let regionName: String?
        /// One of potential statuses a Region can undergo (Enabled, Enabling, Disabled, Disabling, Enabled_By_Default).
        public let regionOptStatus: RegionOptStatus?

        @inlinable
        public init(regionName: String? = nil, regionOptStatus: RegionOptStatus? = nil) {
            self.regionName = regionName
            self.regionOptStatus = regionOptStatus
        }

        private enum CodingKeys: String, CodingKey {
            case regionName = "RegionName"
            case regionOptStatus = "RegionOptStatus"
        }
    }

    public struct ResourceNotFoundException: AWSErrorShape {
        /// The value populated to the x-amzn-ErrorType response header by API Gateway.
        public let errorType: String?
        public let message: String

        @inlinable
        public init(errorType: String? = nil, message: String) {
            self.errorType = errorType
            self.message = message
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.errorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
            self.message = try container.decode(String.self, forKey: .message)
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct StartPrimaryEmailUpdateRequest: AWSEncodableShape {
        /// Specifies the 12-digit account ID number of the Amazon Web Services account that you want to access or modify with this operation. To use this parameter, the caller must be an identity in the organization's management account or a delegated administrator account. The specified account ID must be a member account in the same organization. The organization must have all features enabled, and the organization must have trusted access enabled for the Account Management service, and optionally a delegated admin account assigned. This operation can only be called from the management account or the delegated administrator account of an organization for a member account.  The management account can't specify its own AccountId.
        public let accountId: String
        /// The new primary email address (also known as the root user email address) to use in the specified account.
        public let primaryEmail: String

        @inlinable
        public init(accountId: String, primaryEmail: String) {
            self.accountId = accountId
            self.primaryEmail = primaryEmail
        }

        public func validate(name: String) throws {
            try self.validate(self.accountId, name: "accountId", parent: name, pattern: "^\\d{12}$")
            try self.validate(self.primaryEmail, name: "primaryEmail", parent: name, max: 64)
            try self.validate(self.primaryEmail, name: "primaryEmail", parent: name, min: 5)
        }

        private enum CodingKeys: String, CodingKey {
            case accountId = "AccountId"
            case primaryEmail = "PrimaryEmail"
        }
    }

    public struct StartPrimaryEmailUpdateResponse: AWSDecodableShape {
        /// The status of the primary email update request.
        public let status: PrimaryEmailUpdateStatus?

        @inlinable
        public init(status: PrimaryEmailUpdateStatus? = nil) {
            self.status = status
        }

        private enum CodingKeys: String, CodingKey {
            case status = "Status"
        }
    }

    public struct TooManyRequestsException: AWSErrorShape {
        /// The value populated to the x-amzn-ErrorType response header by API Gateway.
        public let errorType: String?
        public let message: String

        @inlinable
        public init(errorType: String? = nil, message: String) {
            self.errorType = errorType
            self.message = message
        }

        public init(from decoder: Decoder) throws {
            let response = decoder.userInfo[.awsResponse]! as! ResponseDecodingContainer
            let container = try decoder.container(keyedBy: CodingKeys.self)
            self.errorType = try response.decodeHeaderIfPresent(String.self, key: "x-amzn-ErrorType")
            self.message = try container.decode(String.self, forKey: .message)
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
        }
    }

    public struct ValidationException: AWSErrorShape {
        /// The field where the invalid entry was detected.
        public let fieldList: [ValidationExceptionField]?
        /// The message that informs you about what was invalid about the request.
        public let message: String
        /// The reason that validation failed.
        public let reason: ValidationExceptionReason?

        @inlinable
        public init(fieldList: [ValidationExceptionField]? = nil, message: String, reason: ValidationExceptionReason? = nil) {
            self.fieldList = fieldList
            self.message = message
            self.reason = reason
        }

        private enum CodingKeys: String, CodingKey {
            case fieldList = "fieldList"
            case message = "message"
            case reason = "reason"
        }
    }

    public struct ValidationExceptionField: AWSDecodableShape {
        /// A message about the validation exception.
        public let message: String
        /// The field name where the invalid entry was detected.
        public let name: String

        @inlinable
        public init(message: String, name: String) {
            self.message = message
            self.name = name
        }

        private enum CodingKeys: String, CodingKey {
            case message = "message"
            case name = "name"
        }
    }
}

// MARK: - Errors

/// Error enum for Account
public struct AccountErrorType: AWSErrorType {
    enum Code: String {
        case accessDeniedException = "AccessDeniedException"
        case conflictException = "ConflictException"
        case internalServerException = "InternalServerException"
        case resourceNotFoundException = "ResourceNotFoundException"
        case tooManyRequestsException = "TooManyRequestsException"
        case validationException = "ValidationException"
    }

    private let error: Code
    public let context: AWSErrorContext?

    /// initialize Account
    public init?(errorCode: String, context: AWSErrorContext) {
        guard let error = Code(rawValue: errorCode) else { return nil }
        self.error = error
        self.context = context
    }

    internal init(_ error: Code) {
        self.error = error
        self.context = nil
    }

    /// return error code string
    public var errorCode: String { self.error.rawValue }

    /// The operation failed because the calling identity doesn't have the minimum required permissions.
    public static var accessDeniedException: Self { .init(.accessDeniedException) }
    /// The request could not be processed because of a conflict in the current status of the resource. For example, this happens if you try to enable a Region that is currently being disabled (in a status of DISABLING) or if you try to change an account’s root user email to an email address which is already in use.
    public static var conflictException: Self { .init(.conflictException) }
    /// The operation failed because of an error internal to Amazon Web Services. Try your operation again later.
    public static var internalServerException: Self { .init(.internalServerException) }
    /// The operation failed because it specified a resource that can't be found.
    public static var resourceNotFoundException: Self { .init(.resourceNotFoundException) }
    /// The operation failed because it was called too frequently and exceeded a throttle limit.
    public static var tooManyRequestsException: Self { .init(.tooManyRequestsException) }
    /// The operation failed because one of the input parameters was invalid.
    public static var validationException: Self { .init(.validationException) }
}

extension AccountErrorType: AWSServiceErrorType {
    public static let errorCodeMap: [String: AWSErrorShape.Type] = [
        "AccessDeniedException": Account.AccessDeniedException.self,
        "ConflictException": Account.ConflictException.self,
        "InternalServerException": Account.InternalServerException.self,
        "ResourceNotFoundException": Account.ResourceNotFoundException.self,
        "TooManyRequestsException": Account.TooManyRequestsException.self,
        "ValidationException": Account.ValidationException.self
    ]
}

extension AccountErrorType: Equatable {
    public static func == (lhs: AccountErrorType, rhs: AccountErrorType) -> Bool {
        lhs.error == rhs.error
    }
}

extension AccountErrorType: CustomStringConvertible {
    public var description: String {
        return "\(self.error.rawValue): \(self.message ?? "")"
    }
}
